package com.grm.service.impl;

import com.grm.common.Result;
import com.grm.mapper.SysMenuMapper;
import com.grm.model.SysMenu;
import com.grm.service.SysMenuService;
import com.grm.util.TreeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysMenuServiceImpl implements SysMenuService {
    @Autowired
    private SysMenuMapper sysMenuMapper;

    @Override
    public Result queryTree() {
        List<SysMenu> sysMenus = sysMenuMapper.queryAll();
        List<SysMenu> tree = TreeUtils.getTree(sysMenus);
        return Result.success(tree);
    }
}
